package work;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import work.SpringConfig;

import java.util.List;

public class test {
    public static void main(String[] args){
        //通过Java配置来实例化spring容器
        AnnotationConfigApplicationContext context=new AnnotationConfigApplicationContext(SpringConfig.class);

        UserService userService=context.getBean(UserService.class);

        List<User>  userList=userService.getUserList();
        for (User user:userList
             ) {
            System.out.println(user.toString());
        }

    }
}
